package com.manda.smart.hub.common.sqlite;

import org.sqlite.SQLiteConfig;

/**
 * @author hongda.li
 */
public final class SqliteCreator {

    private final SQLiteConfig config;

    private SqliteCreator(SQLiteConfig config) {
        this.config = config;
    }

    public static SqliteCreator create() {
        SQLiteConfig config = new SQLiteConfig();
        config.setEncoding(SQLiteConfig.Encoding.UTF_8);
        config.setTempStore(SQLiteConfig.TempStore.MEMORY);
        config.setJournalMode(SQLiteConfig.JournalMode.WAL);
        config.setSynchronous(SQLiteConfig.SynchronousMode.OFF);
        return create(config);
    }

    public static SqliteCreator create(SQLiteConfig config) {
        return new SqliteCreator(config);
    }
}
